package com.h3c.nem.task;

import com.h3c.nem.service.ITbPreWorkerService;
import com.h3c.nem.service.ITbWorkerService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@JobHandler(value="syncAllWorkerJobHandler")
@Component
@Slf4j
public class SyncAllWorkerJobHandler extends IJobHandler {

    @Autowired
    ITbPreWorkerService preWorkerService;

    @Autowired
    ITbWorkerService workerService;

    @Override
    public ReturnT<String> execute(String s) throws Exception {
        XxlJobLogger.log("XXL-JOB, syncAllWorkerJobHandler.");
        log.info("同步全体员工");
        workerService.syncAllWorker();
        log.info("同步全体员工");
        return SUCCESS;
    }
}
